﻿
Create PROCEDURE [dbo].[SynchronizeCurrency]
(
	@Rebuild bit
)
AS
BEGIN
	SET TRANSACTION ISOLATION LEVEL READ COMMITTED;

	BEGIN TRANSACTION;
	BEGIN TRY
		IF (NOT EXISTS (SELECT * FROM [dbo].[Currency]) OR @Rebuild = 1)
		BEGIN
			DELETE FROM [dbo].[Currency];
			INSERT INTO [dbo].[Currency] ([Code],[Symbol],[ChineseName], [EnglishName]) VALUES ('110','HKD','港币', '');
			INSERT INTO [dbo].[Currency] ([Code],[Symbol],[ChineseName], [EnglishName]) VALUES ('116','JPY','日本元', '');
			INSERT INTO [dbo].[Currency] ([Code],[Symbol],[ChineseName], [EnglishName]) VALUES ('121','MOP','澳门元', '');
			INSERT INTO [dbo].[Currency] ([Code],[Symbol],[ChineseName], [EnglishName]) VALUES ('129','PHP','菲律宾比索', '');
			INSERT INTO [dbo].[Currency] ([Code],[Symbol],[ChineseName], [EnglishName]) VALUES ('132','SGD','新加坡元', '');
			INSERT INTO [dbo].[Currency] ([Code],[Symbol],[ChineseName], [EnglishName]) VALUES ('133','KRW','韩国圆', '');
			INSERT INTO [dbo].[Currency] ([Code],[Symbol],[ChineseName], [EnglishName]) VALUES ('136','THB','泰国铢', '');
			INSERT INTO [dbo].[Currency] ([Code],[Symbol],[ChineseName], [EnglishName]) VALUES ('142','CNY','人民币', '');
			INSERT INTO [dbo].[Currency] ([Code],[Symbol],[ChineseName], [EnglishName]) VALUES ('300','EUR','欧元', '');
			INSERT INTO [dbo].[Currency] ([Code],[Symbol],[ChineseName], [EnglishName]) VALUES ('302','DKK','丹麦克朗', '');
			INSERT INTO [dbo].[Currency] ([Code],[Symbol],[ChineseName], [EnglishName]) VALUES ('303','GBP','英镑', '');
			INSERT INTO [dbo].[Currency] ([Code],[Symbol],[ChineseName], [EnglishName]) VALUES ('304','DEM','德国马克','');
			INSERT INTO [dbo].[Currency] ([Code],[Symbol],[ChineseName], [EnglishName]) VALUES ('305','FRF','法国法郎', '');
			INSERT INTO [dbo].[Currency] ([Code],[Symbol],[ChineseName], [EnglishName]) VALUES ('307','ITL','意大利里拉', '');
			INSERT INTO [dbo].[Currency] ([Code],[Symbol],[ChineseName], [EnglishName]) VALUES ('312','ESP','西班牙比赛塔', '');
			INSERT INTO [dbo].[Currency] ([Code],[Symbol],[ChineseName], [EnglishName]) VALUES ('315','ATS','奥地利先令', '');
			INSERT INTO [dbo].[Currency] ([Code],[Symbol],[ChineseName], [EnglishName]) VALUES ('318','FIM','芬兰马克', '');
			INSERT INTO [dbo].[Currency] ([Code],[Symbol],[ChineseName], [EnglishName]) VALUES ('326','NOK','挪威克朗', '');
			INSERT INTO [dbo].[Currency] ([Code],[Symbol],[ChineseName], [EnglishName]) VALUES ('330','SEK','瑞典克朗', '');
			INSERT INTO [dbo].[Currency] ([Code],[Symbol],[ChineseName], [EnglishName]) VALUES ('331','CHF','瑞士法郎', '');
			INSERT INTO [dbo].[Currency] ([Code],[Symbol],[ChineseName], [EnglishName]) VALUES ('501','CAD','加拿大元', '');
			INSERT INTO [dbo].[Currency] ([Code],[Symbol],[ChineseName], [EnglishName]) VALUES ('502','USD','美元', '');
			INSERT INTO [dbo].[Currency] ([Code],[Symbol],[ChineseName], [EnglishName]) VALUES ('601','AUD','澳大利亚元', '');
			INSERT INTO [dbo].[Currency] ([Code],[Symbol],[ChineseName], [EnglishName]) VALUES ('609','NZD','新西兰元', '');
		END
		COMMIT;
	END TRY
	BEGIN CATCH
	    ROLLBACK;
	END CATCH
END